/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package chess;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author mauricio
 */
public class Conexion {
    
    Connection conn;
    
    public Conexion(){
        conn = null;
    }
        
    public Connection startConnection(){
        String driver = "com.mysql.jdbc.Driver";
        try {
            Class.forName(driver).newInstance();
            try {
                String database = "Chess";
                String host = "localhost:3306";
                conn = DriverManager.getConnection("jdbc:mysql://"+host+"/"
                        +database+"?user=root&password=dreadlovehina28");
                return conn;
            } catch (SQLException ex) {
                return null;
            }
        } 
        catch (Exception e) {
            return null;
        }
    }
}
